/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.ifal.alsuhaul.bd;

import br.edu.ifal.alsuhaul.modelo.Funcionario;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Usuario
 */
public class LoginBd {
     public Funcionario confirmarLogin(String login) throws SQLException {
        Connection fc = null;
        fc = new ConexaoAlsuhaul().abreConexao();
        String sql = "select* from Funcionario where login = ?";
        PreparedStatement stmt = fc.prepareStatement(sql);
        stmt.setString(1, login);
        ResultSet rs = stmt.executeQuery();
        Funcionario c1 = new Funcionario();
        while (rs.next()) {
            c1.setSenha(rs.getString("senha"));
            c1.setLogin(rs.getString("login"));
          
        }
        rs.close();
        stmt.close();
        fc.close();


        return c1;



    }


}
